$(function  () {

    //cookie数据赋值
    var id = $.cookie("uid");
    var colleage = $.cookie("ucolleage");
    var xnum = $.cookie("uxnum");
    var username = $.cookie("uname");
    var pwd = $.cookie("upwd");


    $("#colle").val(colleage);
    $("#xnm").val(xnum);
    $("#name").val(username);
    $("#pwd").val(pwd);


    layui.use('form', function(){
        var form = layui.form();
        //监听提交
        form.on('submit(edit)', function(data){
              var colleag1e = $("#colle").val();
              var xnum1 = $("#xnm").val();
              var username1 = $("#name").val();
              var pwd1 = $("#pwd").val();
              $.ajax({
                url: ipurl+'/user/update',
                data: {
                    id:id,
                    name: username1,
                    pwd: pwd1,
                    colleage:colleag1e,
                    xnum:xnum1
                },
                type: "POST",
                //dataType: "json",
                complete: function(data) {
                }
            });
            x_admin_close();
            top.location.reload();
          });
    });

})
